package com.example.demo.Result;

import lombok.Data;
import org.springframework.context.annotation.Configuration;

@Data
public class Response<T> {
    private String status;     // 响应状态码
    private String message;    // 响应消息
    private T data;            // 响应数据

    // 构造函数、getter、setter...

    public Response(String status, String message, T data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public static <T> Response<T> success(T data) {
        return new Response<>("200", "成功", data);
    }

    public static <T> Response<T> error(String message) {
        return new Response<>("500", message, null);
    }

    // Getters and Setters...
}
